package yxy.game.pm2.module.therionHunting;

import yxy.game.pm2.bean.PlayerBean;
import yxy.game.pm2.bean.ServerBean;
import yxy.game.pm2.bean.area.AreaBean;
import yxy.game.pm2.bean.area.AreaGroupBean;
import yxy.game.pm2.bean.module.rank.AreaGroupRankModule;
import yxy.game.pm2.bean.module.rank.PlayerRankModule;

/**
 * @author wrs
 * @name AreaGroupRankTherionChallege
 * @description 世界神兽挑战排行
 * @since 2022-06-13
 */
public class WorldRankTherionChallege extends AreaGroupRankModule {

    private int therion; //神兽类型；4青龙，5白虎，6朱雀，7玄武

    public WorldRankTherionChallege(AreaGroupBean areaGroupBean, int therion){
        super(areaGroupBean);
        this.therion = therion;
        initInfo();
    }

    public int getTherion() {
        return therion;
    }

    @Override
    public String rankName() {
        return PlayerRankModule.getAllRankNames().get(17);
    }

    @Override
    protected long valuePlastic(long value) {
        return value * 100;
    }

    @Override
    protected long valueRestore(long score) {
        return score / 100;
    }

    @Override
    public int topSize() {
        return 50;
    }

    @Override
    protected String rankKey() {
        return String.format("THERION:WORLD:%s:GODBEAST:%s",getAreaGroupId(),therion,rankName());
    }

    static public WorldRankTherionChallege getRank(String playerCode, int therion){
        PlayerBean playerBean = PlayerBean.get(playerCode);
        ServerBean serverBean = ServerBean.get(playerBean.getServerId());
        AreaBean areaBean = AreaBean.get(serverBean.getAreaId());
        AreaGroupBean areaGroupBean = AreaGroupBean.get(areaBean.getGroupId());
        return new WorldRankTherionChallege(areaGroupBean,therion);
    }

    static public WorldRankTherionChallege getRank(AreaGroupBean areaGroupBean, int therion){
        return new WorldRankTherionChallege(areaGroupBean,therion);
    }
}
